package com.woniuxy.productServer.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.woniuxy.productServer.model.SessionTicket;
import com.woniuxy.productServer.dao.SessionTicketMapper;
import com.woniuxy.productServer.service.SessionTicketService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 杜岷芫
 * @since 2024年03月20日
 */
@Service
public class SessionTicketServiceImpl extends ServiceImpl<SessionTicketMapper, SessionTicket> implements SessionTicketService {

    @Override
    public Boolean updateSessionTicketsByIds(List<Integer> ticketIds) {
        SessionTicket ticket = new SessionTicket();
        ticket.setTicketState(1);
        int update = this.baseMapper.update(ticket, new UpdateWrapper<SessionTicket>().in("ticket_id", ticketIds).eq("ticket_state", 0));
        return update==ticketIds.size();
    }
}
